package com.cpecc.controller.wuzi;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cpecc.manager.system.UserManager;
import com.cpecc.manager.wuzi.WeiXiuManager;
import com.cpecc.model.system.User;

@Controller
@RequestMapping(value = "/wuzi")
public class MyWeiXiuController {

	@Autowired
	private WeiXiuManager weiXiuManager;
	
	@Autowired
	private UserManager userManager;
	
	@RequestMapping(value = "/myWeiXiu")
	public ModelAndView myShenQing(){
		ModelAndView mav=new ModelAndView();		
		Subject currentUser = SecurityUtils.getSubject();
		Object obj=currentUser.getPrincipals();
		String name=obj.toString();
		User user=userManager.findByUsername(name);
		mav.addObject("myWeiXiuList", weiXiuManager.getMyWeiXiu(user));
		mav.setViewName("weixiu/myWeiXiu");
		return mav;
	}
}
